@include('Home.head')
<body>
<div class="container" id="app">
    @include('Home.member.header')
    <div class="am-cf cart-panel">
        <div class="withdrawals-panel">
            <div class="partners-title-panel" v-for="val,index in banklist">
                <div class="partners-title-panel-title" style="height: 80px;padding-left: 10px;">
                    <a style="font-size: 15px;">@{{ val.bank_name }}  &nbsp;@{{ val.card_number }}</a><br>
                    <a style="width:100%;height:49px;font-size: 12px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">@{{ val.bank_address }}</a>
                    {{--<span class="am-fr am-icon-trash-o" v-on:click="del(val.id,index)"></span>--}}
                    <span class="am-fr am-icon-pencil-square-o" v-on:click="edit(val.id)"></span>
                </div>
            </div>
        </div>
        <p class="am-text-center" onclick="window.location.href='/home/member/bank'"><button type="button" class="am-btn am-btn-danger am-radius am-btn-block" style="border-radius: 50px;">添加银行卡</button></p>
    </div>
    @include('Home.foot')
</div>
</body>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            title:'收货地址',
            bank: {
                'id':'',
                'name':'',
                'phone':'',
                'bank_name':1,
                'bank_address':'',
                'card_number':'',
            },
            banklist:[],
        },
        methods: {
            //初始化 系统管理员列表
            initialize:function () {
                $.post("/home/member/addbank",{'_token':'{{csrf_token()}}',class:'select'},function (res) {
                    if(res.code){
                        app.banklist = res.data
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            add:function () {
                $.post("/home/member/addbank",{'_token':'{{csrf_token()}}',class:'add',bank:app.bank},function (res) {
                    if(res.code){
                        layer.msg(res.data);
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            del:function (id,index) {
                $.post("/home/member/addbank",{'_token':'{{csrf_token()}}',class:'delete',id:id},function (res) {
                    if(res.code){
                        app.banklist.splice(index,1)
                    } else {
                        layer.msg(res.data);
                    }
                });
            },
            edit:function (id) {
                window.location.href="/home/member/bank?id="+id;
            },
        },
        //自动执行
        mounted: function () {
            this.initialize();//分公司
        },
    });
</script>
</html>
